class Person {
    public name: string;

    constructor(name: string) {
        this.name = name
    }
}

class Teacher extends Person {
    constructor(public age: number) { // 这里 age 是简略写法，相当于声明一个 this.age 并赋值为 age
        super('jspang'); // 子类有构造函数，必须也调用父类的构造函数
    }
}

const teacher = new Teacher(18)

console.log(teacher.age)
console.log(teacher.name)
